package com.harmontronics.hanma.paas.paas.domain.app.repository.persistence;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.harmontronics.hanma.paas.paas.domain.app.entity.HmDatasource;
import com.harmontronics.hanma.paas.paas.domain.app.entity.valueobject.Fields;
import com.harmontronics.hanma.paas.paas.domain.app.repository.mapper.HmDatasourceMapper;
import com.harmontronics.hanma.paas.paas.domain.app.repository.po.HmDatasourcePO;
import com.harmontronics.hanma.paas.paas.domain.app.repository.po.HmEntityModelPO;
import org.springframework.stereotype.Repository;


@Repository("hmDatasourceRepository")
public class HmDatasourceRepository extends ServiceImpl<HmDatasourceMapper, HmDatasourcePO> {

    public IPage<HmDatasourcePO> selectPage(QueryWrapper<HmDatasourcePO> queryWrapper, Page<HmDatasourcePO> page) {
        return baseMapper.selectPage(page, queryWrapper);
    }

    public HmDatasourcePO findByKey(String key) {
        QueryWrapper<HmDatasourcePO> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq(Fields.KEY_DB,key);
        return baseMapper.selectOne(queryWrapper);
    }
}